<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>
<script>
spellcheck_test(
    '<iframe></iframe>',
    parentDocument => {
      const iframe = parentDocument.querySelector('iframe');
      const document = iframe.contentDocument;
      document.documentElement.contentEditable = true;
      document.documentElement.focus();
      document.execCommand('insertText', false, 'zz.');

      if (window.internals)
        internals.runIdleTimeSpellChecker(document);

      // Remove frame after sending the spellcheck request and before its response.
      iframe.remove();
    },
    '',
    'Spellchecker should not crash when frame is removed.');
</script>
